package app.v1.common.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.YearMonth;

/**
 * 表映射器
 * @author feizns
 * @since 2023/07/19
 */
@Mapper
public interface TableMapper {

    /**
     * 判定指定表是否存在
     * @param tableName 表名
     * @return boolean
     */
    @Select("SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='wekang-plus' AND TABLE_NAME= ${tableName}")
    boolean existsTable(@Param("tableName") String tableName);

    /**
     * 根据模板表创建表
     */
    void createWdtSalesOrderDetailsMonthTable(@Param("yearMonth") YearMonth yearMonth);

}
